package com.aq.dao.imp;

import java.util.Map;

import org.hibernate.Query;

import com.aq.dao.NewsDao;
import com.hs.common.page.PageParam;
import com.hs.common.page.PageQuery;
import com.hs.common.page.PageUtil;
import com.hs.core.dao.BaseDao;

public class NewsDaoImpl extends BaseDao implements NewsDao{

	public PageUtil getNewsList(PageParam pageParam) {
		PageQuery pq = new PageQuery(pageParam);
		Query query = null;
		query = this.getSession().createQuery(pageParam.getSearchSql());
		Map map =pageParam.getConditionMap();
		
		int i = 0;
		if(map.containsKey("title"))
		{
			query.setString(i++, "%"+(String)map.get("title")+"%");
		} 
		PageUtil pu = pq.getPageUtil(query);
		return pu;
	}

}
